package com.gu.dao;

import com.gu.resultMap.ApartmentWithUserMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.gu.entity.ApartmentDO;
import java.util.List;
import com.gu.mapper.ApartmentMapper;

/**
* The Table gu_apartment.
* 公寓表
*/
@Repository
public class ApartmentDAO {

    @Autowired
    private ApartmentMapper apartmentMapper;

    /**
     * desc:插入表:gu_apartment.<br/>
     *
     * @param entity entity
     * @return Integer
     */
    public Integer insert(ApartmentDO entity) {
        return apartmentMapper.insert(entity);
    }

    /**
     * desc:批量插入表:gu_apartment.<br/>
     *
     * @param list list
     * @return Integer
     */
    public Integer insertBatch(List<ApartmentDO> list) {
        return apartmentMapper.insertBatch(list);
    }

    /**
     * desc:根据主键删除数据:gu_apartment.<br/>
     *
     * @param id id
     * @return Integer
     */
    public Integer deleteById(Integer id) {
        return apartmentMapper.deleteById(id);
    }

    /**
     * desc:根据主键获取数据:gu_apartment.<br/>
     *
     * @param id id
     * @return ApartmentDO
     */
    public ApartmentDO getById(Integer id) {
        return apartmentMapper.getById(id);
    }

//    public List<String> getUsedApartmentRoomNumber(ApartmentDO entity) {
//    }
//
//    public List<String> getNotUsedApartmentRoomNumber(ApartmentDO entity) {
//    }

    public List<ApartmentWithUserMap> listApartment(ApartmentDO apartmentDO) {
        return apartmentMapper.listApartment(apartmentDO);
    }

    public int updateApartment(Integer userId, Integer id) {
        return apartmentMapper.updateApartment(userId, id);
    }

    public int updateApartmentUserId(Integer userId, Integer id) {
        return apartmentMapper.updateApartmentUserId(userId, id);
    }

    public List<String> getUsedApartmentRoomNumber(ApartmentDO entity) {
        return apartmentMapper.getUsedApartmentRoomNumber(entity);
    }

    public List<String> getNotUsedApartmentRoomNumber(ApartmentDO entity) {
        return apartmentMapper.getNotUsedApartmentRoomNumber(entity);
    }


    public List<ApartmentDO> getAllApartment(){
        return apartmentMapper.getAllApartment();
    }

    public List<ApartmentDO> getApartmentByUser(Integer userId){
        return apartmentMapper.getApartmentByUser(userId);
    }

}